package com.study.happystudy.mapper;

import com.study.happystudy.po.Question;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface QuestionMapper {

    // 新建题目
    int addQuestion(@Param("questionType") String questionType,
                    @Param("score") int score,
                    @Param("description") String description,
                    @Param("options") String options,
                    @Param("correctAnswer") String correctAnswer,
                    @Param("subjectId") int subjectId,
                    @Param("analysis")String analysis);

    // 根据ID返回题目
    Question getQuestionById(@Param("questionId") int questionId);

    // 根据科目ID获取所有题目
    List<Question> getQuestionsBySubjectId(@Param("subjectId") int subjectId);

    // 根据ID删除题目
    int deleteQuestionById(@Param("questionId") int questionId);

    // 根据题目类型筛选
    List<Question> getQuestionsByType(@Param("questionType") String questionType);

    // 根据科目ID和题目类型筛选
    List<Question> getQuestionsBySubjectIdAndType(@Param("subjectId") int subjectId, @Param("questionType") String questionType);


}
